<template>
	<section>
		<!--工具条-->
		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
			<el-form :inline="true" :model="filters">
				<el-form-item>
					<el-input v-model="keyword" placeholder="请输入关键字"></el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" v-on:click="keywordQuery">关键字查询</el-button>
				</el-form-item>
			</el-form>
		</el-col>

		<!--列表-->
		<el-table :data="dictionarytpyes" highlight-current-row v-loading="listLoading" @selection-change="" style="width: 100%;"
      @row-dblclick="doubleclick"
    >
			<el-table-column type="selection" width="55">
			</el-table-column>
			<el-table-column type="index" width="60">
			</el-table-column>
			<el-table-column prop="sn" label="字典编号" width="120" sortable>
			</el-table-column>
			<el-table-column prop="name" label="字典名称" width="120"  sortable>
			</el-table-column>
		</el-table>


    <!--抽屉-->
    <el-drawer
        title="数据字典明细"
        :visible.sync="table"
        direction="rtl"
        size="50%">
      <el-table :data="detailData">
        <el-table-column type="index" label="序列号" width="150"></el-table-column>
        <el-table-column prop="name" label="字典明细名称" width="200"></el-table-column>
      </el-table>
    </el-drawer>
		<!--工具条-->
		<el-col :span="24" class="toolbar">
      <!-- 分页栏-->
      <el-pagination layout="prev, pager, next" @current-change="getDictionarytype"
                     :page-size="pageSize" :total="totals" :current-page="currentPage" style="float:right;">
      </el-pagination>
		</el-col>

	</section>
</template>


<script>
	import util from '../../common/js/util'
	//import NProgress from 'nprogress'
	import { getEmployeeListPage, removeEmployee, batchRemoveEmployee, editEmployee, addEmployee } from '../../api/api';

	export default {
		data() {
			return {

        table: false,
        keyword:null,
        dictionarytpyes:[],
			  totals:0,
        pageSize:2,
        currentPage:1,
				listLoading: false,
        detailData:[]




			}
		},
		methods: {
      //双击展示抽屉
      doubleclick(row){

        this.$http.get("/dictionarydetail/t/"+row.id).then(res=>{
          this.detailData = res.data;
        })
        this.table = true;

      },
      //关键字查询
      keywordQuery(){
        this.currentPage = 1;
        this.getDictionarytype();
      },
			//获取用户列表
			getDictionarytype(val) {
        if(val != null){
          this.currentPage = val;
        }
				//开启忙等框
				this.listLoading = true;
				//发送请求
			  this.$http.post("/dictionarytype",{pageSize:this.pageSize,currentPage:this.currentPage,keyword:this.keyword})
            .then(res=>{

              this.totals=res.data.totals;
              this.dictionarytpyes=res.data.data;
              //关闭忙等框
              this.listLoading = false;
        }).catch(res=>{
          this.$message.error("系统错误")
        })
			}

		},
		mounted() {
			this.getDictionarytype();
		}
	}

</script>

<style scoped>

</style>